﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Helpers.Extensions
{
    public static class DictionaryExtansions
    {
        public static void AddOrReset<TK, TV>(this Dictionary<TK, TV> set, TK key, TV value)
        {
            if (set.ContainsKey(key))
                set[key] = value;
            else
                set.Add(key, value);
        }

        public static void RemoveIfExist<TK, TV>(this Dictionary<TK, TV> set, TK key)
        {
            if (set.ContainsKey(key))
                set.Remove(key);
        }
    }
}
